package com.jhhc.StormSurgeForecast.AstronomicalTide.Pojo;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;

@Data
public class BDMS_ST_ASTROTD_F implements Serializable {
    private String stcd;

    private String ymdh;
    private Double ftdz;
    @Override
    public String toString() {
        return "BDMS_ST_ASTROTD_F{" +
                "stcd='" + stcd + '\'' +
                ", ymdh=" + ymdh +
                ", ftdz=" + ftdz +
                ", hltdmk=" + hltdmk +
                ", unitname=" + unitname +
                '}';
    }



    private Integer hltdmk;

    private Integer unitname;

    public String getStcd() {
        return stcd;
    }

    public void setStcd(String stcd) {
        this.stcd = stcd == null ? null : stcd.trim();
    }

    public String getYmdh() {
        return ymdh;
    }

    public void setYmdh(String ymdh) {
        this.ymdh = ymdh;
    }

    public Double getFtdz() {
        return ftdz;
    }

    public void setFtdz(Double ftdz) {
        this.ftdz = ftdz;
    }

    public Integer getHltdmk() {
        return hltdmk;
    }

    public void setHltdmk(Integer hltdmk) {
        this.hltdmk = hltdmk;
    }

    public Integer getUnitname() {
        return unitname;
    }

    public void setUnitname(Integer unitname) {
        this.unitname = unitname;
    }


    @JSONField(serialize = false)
    private String hour;
    @JSONField(serialize = false)
    private String day;
    @JSONField(serialize = false)
    private String dateTime;
    @JSONField(serialize = false)
    private String month2;


    @JSONField(serialize = false)
    public String getMonth2() {
        return setMonth2();
    }
    @JSONField(serialize = false)
    public String setMonth2() {
        String month1 = getYmdh();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 日期格式转换 月份
        try {

            return  format.format(format.parse(month1)).substring(11,16);

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    @JSONField(serialize = false)
    public String getHour() {
        return setHour();
    }
    @JSONField(serialize = false)
    public String setHour() {
        String month1 = getYmdh();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 日期格式转换 月份
        try {

            return  format.format(format.parse(month1)).substring(11,13);

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    //根据天分组
    @JSONField(serialize = false)
    public String getDateTime() {
        return setDateTime();
    }
    @JSONField(serialize = false)
    public String setDateTime() {
        String month1 = getYmdh();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 日期格式转换 月份
        try {

            return  format.format(format.parse(month1)).substring(0,7);

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    //根据天分组
    @JSONField(serialize = false)
    public String getDay() {
        return setDay();
    }
    @JSONField(serialize = false)
    public String setDay() {
        String month1 = getYmdh();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 日期格式转换 月份
        try {

            return  format.format(format.parse(month1)).substring(0,10);

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }


}